#include <57header.h>

int main(int argc,char*argv[])
{
    
    key_t key = ftok("./01_code2.c", 10);
    int shmid = shmget(key, 4096, 0600|IPC_CREAT);

    int *p = (int *)shmat(shmid, NULL, 0);
    p[0] = 0;

    if(fork() == 0){
        for(int i = 0; i < 10000000; i++){
            p[0]++;
        }
    }else{
        for(int i = 0; i < 10000000; i++){
            p[0]++;
        }

        wait(NULL);
        printf("%d \n", p[0]);
    }
    return 0;
}
